package dk.viauc.cmclang.intlang;

import java.util.ArrayList;

import javax.swing.*;

public class TestDriverScanner 
{	//TODO
	private static final String EXAMPLES_DIR =  "C:\\Users\\vbihl\\Documents\\Eclipse\\CMCLang\\newrev";
		
		
		public static void main( String args[] )
		{
			JFileChooser fc = new JFileChooser( EXAMPLES_DIR );
			ArrayList<String> varList = new ArrayList<String>();
			ArrayList<String> kwList = new ArrayList<String>();
			if( fc.showOpenDialog( null ) == fc.APPROVE_OPTION ) {
				SourceFile in = new SourceFile( fc.getSelectedFile().getAbsolutePath() );
				IScanner s = new Scanner( in );
			
				Token t = s.scan();
				while( t.kind != Token.EOT ) {
					//System.out.println( t.kind + " " + t.spelling );
					if(t.kind == Token.IDENTIFIER || t.kind==Token.FUNCTION || t.kind==Token.ENDFUNCTION || t.kind == Token.LET)
						varList.add(t.spelling);
					t = s.scan();
				}
				
				//for(String a : varList)
					//System.out.println(a);
			
			}
		}
}
